package robot

import (
	"device-admin/internal/app/grpc/protoc/robotc"
	"device-admin/internal/app/web/service/devlog"

	"google.golang.org/protobuf/proto"
)

// DevEventLogHandle 上位机异常事件
func DevEventLogHandle(robotID string, msg *robotc.WildMsg) {
	devEventLog := &robotc.NotifyDevEventLog{}
	err := proto.Unmarshal(msg.GetBodyContent(), devEventLog)
	if err != nil {
		return
	}
	devlog.AddDevEventLog(robotID, string(devEventLog.GetMsg()), int(devEventLog.GetLevel()))
}
